<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" type="text/css" th:href="@{/bootstrap/css/bootstrap.css}">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script type="text/javascript" th:src="@{/bootstrap/js/jquery-3.5.1.js}"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script type="text/javascript" th:src="@{/bootstrap/js/bootstrap.js}"></script>
    <style>

        .disableCss {
            pointer-events: none;
            color: #afafaf;
            cursor: default;
            opacity: 0.5;
        }

        .container-fluid {
            padding-right: 75px;
            padding-left: 75px;
        }
    </style>
    <script>
        function goDetail(stuid, name, sex, password, power) {
            $("#stuid").val(stuid);
            $("#name").val(name);
            $("#sex").val(sex);
            $("#password").val(password);
            $("#power").val(power);
        }

    </script>
</head>

<body>
<div class="container-fluid">
    <div class="row clearfix">
        <div class="col-md-auto column">
            <div class="page-header">
                <h3>
                    学生信息管理 <small>管理学生信息：</small>
                </h3>
            </div>
            <table class="table">
                <thead>
                <tr>
                    <th>学号</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>权限</th>
                    <th>密码</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="stu:${message}">
                    <td th:text="${stu.getStuid()}"></td>
                    <td th:text="${stu.getName()}"></td>
                    <td th:text="${stu.getSex()}"></td>
                    <td th:text="${stu.getPower()}"></td>
                    <td>*********</td>
                    <td>
                        <a type="button" class="btn btn-info" th:href="@{/updateStudent/}+${stu.getStuid()}">编辑</a>
                        <a type="button" class="btn btn-danger" th:href="@{/index/delete/}+${stu.getStuid()}">删除</a>
                    </td>
                </tr>
                </tbody>
                <h2>
                    <button class="btn btn-sm btn-success" data-target="#myModal1" data-toggle="modal">添加学生信息</button>
                    <a type="button" class="btn btn-success" th:href="@{/reportExcel/}+1">导出Excel表格</a>
                    <form th:action="@{/index/select}">
                        <select name="type">
                            <option value="stuid">按学号查询</option>
                            <option value="name">按姓名查询</option>
                        </select>
                        <label>查询内容：</label>
                        <input type="text" name="content">
                        <button type="submit" class="btn btn-success">提交</button>
                    </form>
                </h2>
                <!-- Modal -->
                <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                        aria-hidden="true">&times;</span>
                                </button>
                                <h4 class="modal-title">添加学生信息</h4>
                            </div>
                            <div class="modal-body">
                                <form th:action="@{/index/insert}">
                                    <p align="center">
                                        学号：<input type="text" name="stuid"><br>
                                        权限：<input type="text" name="power" value="没有权限"><br>
                                        姓名：<input type="text" name="name"><br>
                                        性别：<input type="text" name="sex"><br>
                                        密码：<input type="text" name="password" value="123456"><br>
                                        <button type="submit" class="btn btn-success">提交</button>
                                    </p>
                                </form>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-danger" data-dismiss="modal">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </table>
        </div>
    </div>
</div>
</body>
</html>
